﻿(function ($) {
    $.validator.addMethod(
        "fecha",
        function (value, element) {
            // return (!value && this.optional(element)) || /*place your validation logic here*/;

            var dateParts = value.split("/");

            var date = new Date(dateParts[2], (dateParts[1] - 1), dateParts[0]).setHours(0, 0, 0, 0);
            var hoy = new Date().setHours(0, 0, 0, 0);
            if (date >= hoy) return true;
            return false;


        },
        "Mallll");
    $.validator.unobtrusive.adapters.addBool("fecha");
} (jQuery));

function objToString(obj) {
    var str = '';
    for (var p in obj) {
        if (obj.hasOwnProperty(p)) {
            str += p + '::' + obj[p] + '\n';
        }
    }
    return str;
}

Date.prototype.defaultView = function () {
    var dd = this.getDate();
    if (dd < 10) dd = '0' + dd;
    var mm = this.getMonth() + 1;
    if (mm < 10) mm = '0' + mm;
    var yyyy = this.getFullYear();
    return String(dd + "-" + mm + "-" + yyyy)
}


